package com.litchishell.easy;

/**
 * @author LitchiShell
 * @description: 题目83：删除排序链表的重复元素
 * @create 2022-08-30
 */
public class Solution016 {

    public ListNode deleteDuplicates(ListNode head) {
        if (head == null) {
            return head;
        }
        ListNode temp = head;
        while(temp.next != null) {
            if (temp.val == temp.next.val) {
                temp.next = temp.next.next;
            } else {
                temp = temp.next;
            }
        }
        return head;
    }
}
